
/*    HTTP Host:  static.ak.fbcdn.net                                          */
/*    Generated:  August 26th 2009 6:51:32 PM PDT                              */
/*      Machine:  10.16.139.103                                                */
/*       Source:  Backing Store                                                */
/*     Location:  js/69gqxn7o10w8ocog.pkg.js h:f452oe0b                        */
/*       Locale:  nu_ll                                                        */
/*         Path:  js/69gqxn7o10w8ocog.pkg.js                                   */
function collect_data_attrib(elem, type) {
	var merged_data = {};
	var attr_name = "data-" + type;
	while (elem && !DOM.isNode(elem, "body")) {
		var attr_data_str = elem.getAttribute(attr_name);
		if (attr_data_str) {
			var attr_data = JSON.decode(attr_data_str);
			for (var i in attr_data) {
				if (merged_data[i] == undefined) {
					merged_data[i] = attr_data[i];
				}
			}
		}
		elem = elem.parentNode;
	}
	return merged_data;
}
function replace_collected_data_attrib(elem, type, existing_key, new_value) {
	var attr_name = "data-" + type;
	for (; elem && !DOM.isNode(elem, "body"); elem = elem.parentNode) {
		var attr_data_str = elem.getAttribute(attr_name);
		if (attr_data_str) {
			var attr_data = JSON.decode(attr_data_str);
			if (attr_data[existing_key] !== undefined) {
				attr_data[existing_key] = new_value;
				elem.setAttribute(attr_name, JSON.encode(attr_data));
				return true;
			}
		}
	}
	return false;
}
copy_properties(ft, {NF_SOURCE_MINIFEED:9, NF_SOURCE_STREAM:10, NF_SOURCE_HIGHLIGHTS:11, NF_EVENT_IMPRESSION:2, NF_EVENT_SEE_MORE:28, NF_EVENT_PILL_CLICK:37, FT_COM_EXPANSION:"c_exp", STREAM_SOURCES:{9:true, 10:true, 11:true}});
function ft(metadata) {
	var asyncRequestPost = new AsyncSignal("/ajax/f.php", {"meta":metadata}).send();
	return true;
}
ft.f3 = function (elem) {
	ft.logElem(elem);
};
ft.enableFeedTracking = function (value) {
	ft.feedTrackingIsEnabled = value;
	onunloadRegister(function () {
		ft.feedTrackingIsEnabled = false;
	});
};
ft.logElem = function (elem, params) {
	if (!ft.feedTrackingIsEnabled) {
		return;
	}
	var link_data = collect_data_attrib(elem, "ft");
	if (count(link_data)) {
		if (ft.feedTrackingIsEnabled == 1 && ft.STREAM_SOURCES[parseInt(link_data.src, 10)]) {
			return;
		}
		if (params) {
			copy_properties(link_data, params);
		}
		link_data.dest = elem.href;
		ft.logData(link_data);
	}
};
ft.logData = function (link_data) {
	new AsyncSignal("/ajax/f2.php", {link_data:JSON.encode(link_data)}).send();
};
onloadRegister(function () {
	LinkController.registerFallbackHandler(function (elem) {
		ft.logElem(elem);
	}, LinkController.ALL, true);
});
function fc_with_target(fn) {
	return function (elem) {
		var target_info = collect_data_attrib(elem, "comment");
		if (!target_info) {
			Util.error("failed to find target info for " + elem);
			return;
		}
		target_info.link_data = collect_data_attrib(elem, "ft");
		var args = $A(arguments);
		args[0] = target_info;
		return fn.apply(null, args);
	};
}
function feedcomment_get_feedback_sources() {
	return {"FEEDBACK_SOURCE_PROFILE":0, "FEEDBACK_SOURCE_NEWS_FEED":1, "FEEDBACK_SOURCE_OBJECT":2, "FEEDBACK_SOURCE_MOBILE":3, "FEEDBACK_SOURCE_EMAIL":4, "FEEDBACK_SOURCE_API":5, "FEEDBACK_SOURCE_OBJECTS_PAGE":6};
}
function feedcomment_constants() {
}
feedcomment_constants.MAX_COMMENTS_TO_SHOW = 1000;
var feedcomment_submit_d = fc_with_target(function (target_info) {
	return feedcomment_submit(target_info.target_fbid, target_info.item_id, target_info.source, target_info.target_owner, target_info.type_id, target_info.assoc_obj_id, target_info.link_data, target_info.check_hash, target_info.source_app_id);
});
function feedcomment_submit(target_fbid, item_id, source, target_owner, type_id, assoc_object_id, link_data, check_hash, source_app_id) {
	var add_comment_form = _feedcomment_get_add_comment_form(target_fbid, item_id);
	var add_comment_textarea = _feedcomment_get_add_comment_textarea(target_fbid, item_id);
	var comment_button = _feedcomment_get_add_comment_button(target_fbid, item_id);
	var publish_checkbox = _feedcomment_get_publish_story_checkbox(target_fbid, item_id);
	var credits_giver_input = _feedcomment_get_credits_giver_input(target_fbid, item_id, source);
	var num_credits = (credits_giver_input && parseInt(credits_giver_input.value, 10)) || 0;
	var feedcomment_arguments = arguments;
	var publish_story = true;
	if (publish_checkbox) {
		publish_story = publish_checkbox.checked;
	}
	var onResponse = function (asyncResponse) {
		var payload = asyncResponse.getPayload();
		if ("userData" in payload && payload.userData == "nux") {
			if (asyncResponse.isReplay()) {
				return;
			}
			new Dialog(payload).setButtons([{label:_tx("Confirm"), handler:function () {
				feedcomment_submit.apply(this, feedcomment_arguments);
			}, name:"confirm_comment"}, Dialog.CANCEL]).show();
		} else {
			feedcomment_add_comment_onsuccess(payload, target_fbid, item_id, source);
		}
	};
	var comment_text = (add_comment_textarea.getControl && add_comment_textarea.getControl().getValue()) || "";
	comment_text = trim(comment_text);
	if (comment_text || num_credits) {
		comment_button && (comment_button.disabled = true);
		add_comment_textarea && (add_comment_textarea.disabled = true);
		var endpoint = num_credits ? "/ajax/giftcredits/prompt.php" : "/ajax/inline_comments.php";
		var post_data = {"assoc_object_id":assoc_object_id, "check_hash":check_hash, "comment_text":comment_text, "item_id":item_id, "link_data":JSON.encode(link_data), "source":source, "target_fbid":target_fbid, "target_owner":target_owner, "type_id":type_id, "source_app_id":source_app_id, "num_credits":num_credits, "publish_story":publish_story};
		if (num_credits) {
			var fragment = _feedcomment_get_commentable_item_div(target_fbid, item_id, source).getAttribute("id");
			post_data = {app_id:19675640871, receiver:target_owner, back_url:URI.getRequestURI().setFragment(fragment).toString(), order_info:JSON.encode(post_data)};
		}
		req = new AsyncRequest().setURI(endpoint).setData(post_data).setHandler(bind(this, handle_require_email_conf_response, onResponse, null, null)).setFinallyHandler(function () {
			comment_button && (comment_button.disabled = false);
			add_comment_textarea && (add_comment_textarea.disabled = false);
		});
		var sources = feedcomment_get_feedback_sources();
		if (source == sources["FEEDBACK_SOURCE_PROFILE"]) {
			var query = URI.getRequestURI().getQueryData();
			if (query.ref && query.ref == "search") {
				req.setContextData("clicktype", "Write Comment");
				req.setContextData("source", "profile_from_search");
			}
		}
		req.send();
	} else {
		feed_comment_cancel_add_box_onblur();
		animation(add_comment_textarea).to("background", "#fff").from("#fcc").duration(140).go();
	}
	return status;
}
function feedcomment_add_comment_onsuccess(result, target_fbid, item_id, source) {
	var add_comment_form = _feedcomment_get_add_comment_form(target_fbid, item_id);
	var add_comment_textarea = _feedcomment_get_add_comment_textarea(target_fbid, item_id);
	var comment_button = _feedcomment_get_add_comment_button(target_fbid, item_id);
	var publish_checkbox = _feedcomment_get_publish_story_checkbox(target_fbid, item_id);
	var credits_giver_input = _feedcomment_get_credits_giver_input(target_fbid, item_id, source);
	var num_credits = (credits_giver_input && parseInt(credits_giver_input.value, 10)) || 0;
	if (num_credits && "title" in result && "body" in result) {
		new Dialog(result).show();
		return;
	}
	if ("last_comment" in result) {
		feedcomment_append_comment(target_fbid, item_id, result.last_comment, result.comment_count, source);
	} else {
		feedcomment_sync_with_markup(target_fbid, item_id, result.all_comments_html, result.comment_count, source);
	}
	if (credits_giver_input) {
		if ("balance_html" in result) {
			var balance_divs = DOM.scry(document.body, "div.comments_add_box span.balance_text");
			var node = HTML(result.balance_html);
			for (var i = balance_divs.length - 1; i >= 0; --i) {
				balance_divs[i].setContent(node);
			}
		}
		credits_giver_input.value = 0;
		DOM.find(add_comment_form, "div.credits_giver_row").removeClass("credits_giver_row_revealed");
	}
	add_comment_textarea.value = "";
	if (add_comment_textarea.getControl) {
		add_comment_textarea.getControl().setPlaceholderText(_tx("Write another comment..."));
	}
	feed_comment_hide_add_box(target_fbid, item_id, source, false);
}
function feed_comment_record_add_box_onblur(timeoutId) {
	feed_comment_record_add_box_onblur.timeoutId = timeoutId;
}
function feed_comment_cancel_add_box_onblur() {
	var timeoutId = feed_comment_record_add_box_onblur.timeoutId;
	if (timeoutId) {
		clearTimeout(timeoutId);
	}
}
var feed_comment_hide_add_box_d = fc_with_target(function (target_info, onblur_event) {
	return feed_comment_hide_add_box(target_info.target_fbid, target_info.item_id, target_info.source, onblur_event);
});
function feed_comment_hide_add_box(target_fbid, item_id, source, onblur_event) {
	var add_comment_textarea = _feedcomment_get_add_comment_textarea(target_fbid, item_id);
	if (add_comment_textarea) {
		var has_entered_text = add_comment_textarea.getControl && add_comment_textarea.getControl().getValue();
		var commentable_item = _feedcomment_get_commentable_item_div(target_fbid, item_id, source);
		if (!has_entered_text) {
			var comments = _feedcomment_get_feed_comments(target_fbid, item_id);
			if (onblur_event) {
				feed_comment_perform_hide_add_box(commentable_item, comments, add_comment_textarea);
			}
		}
		feedcomment_hide_credits_nux_tip_d(commentable_item);
	}
}
function feed_comment_perform_hide_add_box(commentable_item, comments, add_comment_textarea) {
	if (!add_comment_textarea) {
		return false;
	}
	if (add_comment_textarea.getControl && add_comment_textarea.getControl().getValue()) {
		return false;
	}
	var num_comments = DOM.scry(comments, "div.ufi_section").length;
	var has_likes = (DOM.scry(commentable_item, "div.has_likes").length > 0);
	var has_feedback = (num_comments > 0) || has_likes;
	var is_single_profile_story = CSS.hasClass(commentable_item, "single_profile_story");
	var commentable_form = _feedcomment_get_commentable_item_form(commentable_item);
	if (!has_feedback && !is_single_profile_story) {
		CSS.addClass(commentable_form, "collapsed_comments");
	}
	if (add_comment_textarea.getControl) {
		CSS.addClass(commentable_form, "hidden_add_button");
	}
	DataStore.set(commentable_item, "commentLinkShouldCloseAddBox", false);
	return true;
}
var feed_comment_show_add_button_d = fc_with_target(function (target_info) {
	feed_comment_show_add_button(target_info.target_fbid, target_info.item_id, target_info.source);
});
function feed_comment_show_add_button(target_fbid, item_id, source) {
	var commentable_item = _feedcomment_get_commentable_item_div(target_fbid, item_id, source);
	var commentable_form = _feedcomment_get_commentable_item_form(commentable_item);
	CSS.removeClass(commentable_form, "hidden_add_button");
}
function _feed_comment_update_count(target_fbid, item_id, item_total_count, source) {
	var commentable_item = _feedcomment_get_commentable_item_div(target_fbid, item_id, source);
	feedback_update_toggle_counts(target_fbid, item_id, source, item_total_count);
	if (item_total_count == 0) {
		CSS.removeClass(commentable_item, "with_comments");
		CSS.addClass(commentable_item, "no_comments");
	} else {
		if (CSS.hasClass(commentable_item, "no_comments")) {
			CSS.removeClass(commentable_item, "no_comments");
			CSS.addClass(commentable_item, "with_comments");
		}
		if (CSS.hasClass(commentable_item, "autoexpand_mode")) {
			toggle_feedcomments_box_open(target_fbid, item_id, source, false);
		}
	}
}
function load_more_feed_comments(target_fbid, item_id, target_owner, type_id, assoc_object_id, source, check_hash, range, highlighted_comment_ids) {
	var feed_comments = _feedcomment_get_feed_comments(target_fbid, item_id);
	var comments = DOM.scry(feed_comments, ".ufi_section");
	var first_comment_id = null;
	for (var i = 0; i < comments.length && !first_comment_id; i++) {
		first_comment_id = _feedcomment_get_comment_id(comments[i]);
	}
	load_all_feed_comments(target_fbid, item_id, target_owner, type_id, assoc_object_id, source, check_hash, range, highlighted_comment_ids, first_comment_id);
}
function load_all_feed_comments(target_fbid, item_id, target_owner, type_id, assoc_object_id, source, check_hash, range, highlighted_comment_ids, merge_cutoff_id) {
	if (!assoc_object_id) {
		assoc_object_id = 0;
	}
	if (!source) {
		var sources = feedcomment_get_feedback_sources();
		source = sources["FEEDBACK_SOURCE_PROFILE"];
	}
	var feed_comments = _feedcomment_get_feed_comments(target_fbid, item_id);
	if (merge_cutoff_id) {
		if (CSS.hasClass(feed_comments, "paging")) {
			return;
		} else {
			CSS.addClass(feed_comments, "paging");
		}
	}
	var add_comment_form = _feedcomment_get_add_comment_form(target_fbid, item_id);
	var onResponse = function (asyncResponse) {
		var result = asyncResponse.getPayload();
		var reload_callback = load_all_feed_comments.curry(target_fbid, item_id, target_owner, type_id, assoc_object_id, source, check_hash);
		feedcomment_sync_with_markup(target_fbid, item_id, result.all_comments_html, result.comment_count, source, merge_cutoff_id, result.pager, result.force_update, result.num_new_comments, reload_callback);
		var highlights = DOM.scry(feed_comments, "div.comment_highlighted");
		for (var i = 0; i < highlights.length; i++) {
			animation(highlights[i]).duration(500).checkpoint().to("backgroundColor", "#ECEFF5").duration(1500).ondone(CSS.removeClass.bind(null, highlights[i], "comment_highlighted")).go();
		}
	};
	var ft_params = {type:ft.FT_COM_EXPANSION};
	ft.logElem(feed_comments, ft_params);
	new AsyncRequest().setURI("/ajax/inline_comments_get.php").setData({"assoc_object_id":assoc_object_id, "check_hash":check_hash, "get_all":1, "comments_range":range, "item_id":item_id, "target_fbid":target_fbid, "target_owner":target_owner, "type_id":type_id, "source":source, "highlighted_comment_ids":highlighted_comment_ids, "cutoff_id":merge_cutoff_id}).setHandler(onResponse).send();
}
function feedcomment_sync_with_markup(target_fbid, item_id, markup, comment_count, source, merge_cutoff_id, paging_header, force_update, num_new_comments, force_update_callback) {
	var feed_comments = _feedcomment_get_feed_comments(target_fbid, item_id);
	if (force_update) {
		CSS.removeClass(feed_comments, "paging");
		var num_old = collect_data_attrib(feed_comments, "comment").num_comments;
		var num_new = num_old ? (comment_count - num_old) : 0;
		new Dialog().setTitle(_tx("Cannot show previous comments")).setBody(num_new > 1 ? _tx("{number} comments have been added since you last refreshed the page. Would you like to view the most recent comments?", {number:num_new}) : _tx("Too many additional comments have been made since you last refreshed the page. Would you like to view the most recent comments?")).setButtons(Dialog.OK_AND_CANCEL).setHandler(function (button) {
			if (button == Dialog.OK) {
				force_update_callback();
			}
		}).show();
	} else {
		if (feed_comments) {
			replace_collected_data_attrib(feed_comments, "comment", "num_comments", comment_count);
			if (merge_cutoff_id) {
				var container = DOM.find(feed_comments, ".paging_container");
				DOM.prependContent(container, HTML(markup));
				feedcomment_update_paging_header(feed_comments, paging_header);
				var comments_pages = DOM.scry(container, ".comments_page");
				var new_comment_page = comments_pages[0];
				animation(new_comment_page).from("height", 0).to("height", "auto").duration(60 * num_new_comments).ondone(feedcomment_cutoff_excessive_comments.curry(feed_comments, container, comments_pages, new_comment_page, num_new_comments)).go();
			} else {
				set_inner_html(feed_comments, markup);
			}
			_feed_comment_update_count(target_fbid, item_id, comment_count, source);
		}
	}
}
function feedcomment_update_paging_header(feed_comments, paging_header) {
	CSS.removeClass(feed_comments, "paging");
	var header = DOM.find(feed_comments, ".paging_header");
	if (paging_header) {
		set_inner_html(header, paging_header);
	} else {
		feed_comments.removeChild(header);
	}
}
function feedcomment_cutoff_excessive_comments(feed_comments, paging_container, comments_pages, new_comment_page, num_new_comments) {
	var total_comments = DataStore.get(paging_container, "total_comments");
	DataStore.set(new_comment_page, "num_comments", num_new_comments);
	if (!total_comments) {
		var original_page = comments_pages[1];
		total_comments = DOM.scry(original_page, ".ufi_section").length;
		DataStore.set(original_page, "num_comments", total_comments);
	}
	total_comments += num_new_comments;
	for (var i = comments_pages.length - 1; i >= 0 && total_comments > feedcomment_constants.MAX_COMMENTS_TO_SHOW; i--) {
		var comments_page = comments_pages[i];
		var num_comments = DataStore.get(comments_page, "num_comments");
		paging_container.removeChild(comments_page);
		total_comments -= num_comments;
		if (!CSS.hasClass(feed_comments, "comments_cutoff")) {
			CSS.addClass(feed_comments, "comments_cutoff");
		}
	}
	DataStore.set(paging_container, "total_comments", total_comments);
}
function feedcomment_scroll_to_comments(target_fbid, item_id, center) {
	var div = _feedcomment_get_comments_target_wrapper(target_fbid, item_id);
	if (div) {
		DOMScroll.scrollTo(div, true, center);
	}
}
function feedcomment_remove_comment(target_fbid, item_id, comment_id, comment_count, source) {
	var comment = _feedcomment_get_comment(target_fbid, item_id, comment_id);
	if (comment) {
		DOM.remove(comment);
		_feed_comment_update_count(target_fbid, item_id, comment_count, source);
	}
}
function feedcomment_append_comment(target_fbid, item_id, markup, comment_count, source) {
	var feed_comments = _feedcomment_get_feed_comments(target_fbid, item_id);
	if (feed_comments) {
		DOM.appendContent(feed_comments, HTML(markup));
		_feed_comment_update_count(target_fbid, item_id, comment_count, source);
	}
}
function remove_feed_comment_dialog(target_fbid, item_id, comment_id, target_owner, source, type_id, assoc_object_id, check_hash, range) {
	var add_comment_form = _feedcomment_get_add_comment_form(target_fbid, item_id);
	var onResponse = function (asyncResponse) {
		var result = asyncResponse.getPayload();
		feedcomment_remove_comment(target_fbid, item_id, comment_id, result.comment_count, source);
	};
	var req = new AsyncRequest().setURI("/ajax/inline_comments.php").setData({"assoc_object_id":assoc_object_id, "check_hash":check_hash, "comments_range":range, "del_id":comment_id, "item_id":item_id, "source":source, "target_fbid":target_fbid, "target_owner":target_owner, "type_id":type_id}).setHandler(onResponse);
	var sources = feedcomment_get_feedback_sources();
	if (source == sources["FEEDBACK_SOURCE_PROFILE"]) {
		var query = URI.getRequestURI().getQueryData();
		if (query.ref && query.ref == "search") {
			req.setContextData("clicktype", "Delete Comment");
			req.setContextData("source", "profile_from_search");
		}
	}
	req.send();
}
var toggle_feedcomments_box_open_d = fc_with_target(function (target_info, focus) {
	return toggle_feedcomments_box_open(target_info.target_fbid, target_info.item_id, target_info.source, focus);
});
function toggle_feedcomments_box_open(sole_target_fbid, item_id, source, focus) {
	var commentable_item = _feedcomment_get_commentable_item_div(sole_target_fbid, item_id, source);
	if (commentable_item) {
		var hidden = false;
		if (DataStore.get(commentable_item, "commentLinkShouldCloseAddBox")) {
			hidden = feed_comment_perform_hide_add_box(commentable_item, _feedcomment_get_feed_comments(sole_target_fbid, item_id), _feedcomment_get_add_comment_textarea(sole_target_fbid, item_id));
		}
		if (!hidden) {
			var commentable_form = _feedcomment_get_commentable_item_form(commentable_item);
			CSS.removeClass(commentable_form, "collapsed_comments");
			var first_textarea = _feedcomment_get_first_item_textarea(commentable_item);
			if (first_textarea && focus) {
				first_textarea.focus();
			}
			DataStore.set(commentable_item, "commentLinkShouldCloseAddBox", true);
		}
	}
}
function toggle_feedcomments_box(sole_target_fbid, item_id, source) {
	var commentable_item = _feedcomment_get_commentable_item_div(sole_target_fbid, item_id, source);
	if (commentable_item) {
		var commentable_form = _feedcomment_get_commentable_item_form(commentable_item);
		CSS.toggleClass(commentable_form, "collapsed_comments");
	}
}
function _feedcomment_get_commentable_item_div(target_fbid, item_id, source) {
	var commentable_item;
	commentable_item = ge("commentable_item_" + item_id + "_" + target_fbid);
	if (commentable_item) {
		return commentable_item;
	}
	var sources = feedcomment_get_feedback_sources();
	if (source == sources["FEEDBACK_SOURCE_OBJECT"] || source == sources["FEEDBACK_SOURCE_OBJECTS_PAGE"]) {
		commentable_item = ge("commentable_item_" + item_id);
	} else {
		commentable_item = ge("commentable_item_" + item_id + "_" + target_fbid);
		if (!commentable_item) {
			commentable_item = ge("commentable_item_" + item_id);
		}
		if (!commentable_item) {
			commentable_item = ge("div_story_" + item_id + "_" + target_fbid);
		}
		if (!commentable_item) {
			commentable_item = ge("div_story_" + item_id);
		}
	}
	return commentable_item;
}
function _feedcomment_get_commentable_item_div_nosource(target_fbid, item_id) {
	if (div = ge("commentable_item_" + item_id)) {
		return div;
	}
	if (div = ge("commentable_item_" + item_id + "_" + target_fbid)) {
		return div;
	}
	return ge("div_story_" + item_id + "_" + target_fbid);
}
function _feedcomment_get_commentable_item_form(commentable_item) {
	return DOM.find(commentable_item, "form.add_comment");
}
function feedback_update_toggle_counts(target_fbid, item_id, source, count) {
	var commentable_item = _feedcomment_get_commentable_item_div(target_fbid, item_id, source);
	if (commentable_item) {
		var links = DOM.scry(commentable_item, "span.feedback_link_count");
		for (var i = 0; i < links.length; ++i) {
			var link = links[i];
			DOM.setText(link, count);
		}
	}
}
function _feedcomment_get_comments_target_wrapper(target_fbid, item_id) {
	return _feedcomment_get_first_existing_elem("comment_box", target_fbid, item_id);
}
function _feedcomment_get_feed_comments(target_fbid, item_id) {
	return _feedcomment_get_first_existing_elem("comments_list_wrapper", target_fbid, item_id);
}
function _feedcomment_get_add_comment_form(target_fbid, item_id) {
	return _feedcomment_get_first_existing_elem("add_comment", target_fbid, item_id);
}
function _feedcomment_get_add_comment_textarea(target_fbid, item_id) {
	return _feedcomment_get_first_existing_elem("add_comment_text", target_fbid, item_id);
}
function _feedcomment_get_publish_story_checkbox(target_fbid, item_id) {
	return _feedcomment_get_first_existing_elem("publish_story", target_fbid, item_id);
}
function _feedcomment_get_credits_giver_input(target_fbid, item_id, source) {
	var item = _feedcomment_get_commentable_item_div(target_fbid, item_id, source);
	var inputs = DOM.scry(item, ".credits_giver_input");
	return inputs.length ? inputs[0] : null;
}
function _feedcomment_get_first_item_textarea(commentable_item) {
	var textareas = commentable_item.getElementsByTagName("textarea");
	if (textareas.length > 0) {
		return textareas[0];
	} else {
		return null;
	}
}
function _feedcomment_get_add_comment_button(target_fbid, item_id) {
	var comment_span = _feedcomment_get_first_existing_elem("submit_comment", target_fbid, item_id);
	return comment_span.firstChild;
}
function _feedcomment_get_add_comment_wrapper(target_fbid, item_id) {
	return _feedcomment_get_first_existing_elem("add_comment_wrapper", target_fbid, item_id);
}
function _feedcomment_get_comment(target_fbid, item_id, comment_id) {
	var elem;
	if (elem = ge("comment_" + item_id + "_" + target_fbid + "_" + comment_id)) {
		return elem;
	} else {
		return ge("comment_" + target_fbid + "_" + comment_id);
	}
}
function _feedcomment_get_comment_id(ufi_section_div) {
	var match = /^comment_(?:\d+_){1,2}(\d+)$/.exec(ufi_section_div.id);
	if (match) {
		match = match[1];
	}
	return match;
}
function _feedcomment_get_first_existing_elem(prefix, target_fbid, item_id) {
	var div = _feedcomment_get_commentable_item_div_nosource(target_fbid, item_id);
	if (div) {
		var found = div.scry("*." + prefix);
		if (found.length) {
			return found[0];
		}
	}
	var elem;
	if (elem = ge(prefix + "_" + item_id + "_" + target_fbid)) {
		return elem;
	} else {
		if (elem = ge(prefix + "_" + target_fbid)) {
			return elem;
		} else {
			return ge(prefix + "_" + item_id);
		}
	}
}
function feedcomment_log_ufi_with_credits() {
	new AsyncRequest().setURI("/ajax/giftcredits/log.php").send();
}
var feedcomment_show_credits_nux_tip_d = fc_with_target(function (target_info) {
	var tip_elem = ge("credits_nux_tip");
	var input_elem = _feedcomment_get_credits_giver_input(target_info.target_fbid, target_info.item_id, target_info.source);
	if (!tip_elem || !input_elem) {
		return;
	}
	if (!shown(tip_elem)) {
		var tip_elem_title = DOM.find(tip_elem, ".credits_nux_tip_title");
		DOM.setContent(tip_elem_title, HTML(_tx("Give Credit to {name}", {"name":target_info.target_owner_name})));
		Vector2.getElementPosition(input_elem, "document").add(-5, 25).setElementPosition(tip_elem);
		$("content").appendChild(tip_elem);
		animation(tip_elem).to("opacity", 1).from(0).show().duration(200).go();
	}
	var timeoutId = DataStore.get(tip_elem, "nuxTipTimeoutId");
	if (timeoutId) {
		clearTimeout(timeoutId);
		DataStore.remove(tip_elem, "nuxTipTimeoutId");
	}
});
var feedcomment_hide_credits_nux_tip_d = fc_with_target(function (target_info) {
	var tip_elem = ge("credits_nux_tip");
	if (tip_elem) {
		DataStore.set(tip_elem, "nuxTipTimeoutId", setTimeout(hide.bind(null, tip_elem), 150));
	}
});
var feedcomment_focus_credits_box_d = fc_with_target(function (target_info) {
	var input_elem = _feedcomment_get_credits_giver_input(target_info.target_fbid, target_info.item_id, target_info.source);
	if (input_elem) {
		DOM.setCaretPosition(input_elem, 0, input_elem.value.length);
	}
});
var feedcomment_increment_credits_input_d = fc_with_target(function (target_info, default_increment) {
	var input_elem = _feedcomment_get_credits_giver_input(target_info.target_fbid, target_info.item_id, target_info.source);
	var cur_value = parseInt(input_elem.value, 10) || 0;
	if (cur_value < 0) {
		cur_value = 0;
	}
	input_elem.value = cur_value + default_increment;
	return true;
});
function feedcomment_verify_credits(input_elem) {
	if (input_elem.value == "") {
		input_elem.value = 0;
	} else {
		if (!/^\d*$/.test(input_elem.value)) {
			input_elem.value = 0;
			animation(input_elem).to("background", "#fff").from("#fcc").duration(140).go();
		}
	}
}
function InlineParticipants(targetId, asyncUri) {
	this.asyncUri = asyncUri;
	this.target = this.getTargetFromId(targetId);
	if ((!this.target) || this.target.pending) {
		return;
	}
	if (this.target.cached) {
		this.toggleVisibility();
	} else {
		this.initializeFromTarget();
		this.fetchParticipants();
	}
}
copy_properties(InlineParticipants.prototype, {getTargetFromId:function (targetId) {
	return $(targetId);
}, fetchParticipants:function () {
	this.target.pending = true;
	new AsyncRequest().setURI(this.asyncUri).setMethod("GET").setReadOnly(true).setData(this.getFetchData()).setHandler(bind(this, "fetchedActorsResponse")).setErrorHandler(bind(this, "fetchedActorsError")).send();
	this.loadTimeout = setTimeout(this.showLoadIndicator.bind(this), 200);
}, showLoadIndicator:function () {
	this.loadTimeout = null;
	if (this.target.pending) {
		this.loading = true;
		CSS.addClass(this.target, "participants_loading");
		show(this.target);
	}
}, hideLoadIndicator:function () {
	if (this.loadTimeout) {
		clearTimeout(this.loadTimeout);
		this.loadTimeout = null;
	}
	if (this.loading) {
		CSS.removeClass(this.target, "participants_loading");
	}
}, getSearchUri:function () {
	return this.target.getAttribute("search_href");
}, fetchedActorsResponse:function (asyncResponse) {
	var payload = asyncResponse.getPayload();
	var show_more = payload["has_more"];
	var actors = payload["actors"];
	var see_all_js = payload["see_all_js"];
	var nameContainers = [];
	if (!actors) {
		return this.fetchedActorsError();
	}
	this.hideLoadIndicator();
	for (var i = 0; i < actors.length; i++) {
		var container = this.createNameContainer(actors[i]);
		this.target.appendChild(container);
	}
	if (show_more) {
		var search_uri = this.getSearchUri();
		var search_text = payload["more_text"] || this.getSearchText();
		if (search_uri) {
			var search_link = $N("a", {href:search_uri, className:"see_all"}, search_text);
			if (see_all_js) {
				var click_handler = new Function(see_all_js);
				Event.listen(search_link, "click", click_handler);
			}
			this.target.appendChild(search_link);
		}
	}
	this.target.pending = false;
	this.target.cached = true;
	this.toggleVisibility(true);
	animation(this.target).show().from("opacity", 0).to("opacity", 1).duration(450).go();
}, getSearchText:function () {
	return _tx("See all...");
}, fetchedActorsError:function (asyncResponse) {
	this.target.pending = false;
	var search_uri = this.getSearchUri();
	if (search_uri) {
		goURI(search_uri);
	} else {
		hide(this.target);
	}
}, createNameContainer:function (spec) {
	var container = $N("div", {title:spec.name, className:"name_container " + (spec.div_class || "")}, null);
	var pic = $N("img", {src:spec.img_src, alt:spec.name, className:"UIProfileImage UIProfileImage_LARGE"});
	if (spec.profile_href) {
		var pic_link = $N("a", {className:"pic_container", href:spec.profile_href}, pic);
		var name_link = $N("a", {href:spec.profile_href}, spec.first_name);
	} else {
		var pic_link = $N("span", {className:"pic_container"}, pic);
		var name_link = $N("span", {className:"name_link"}, spec.first_name);
	}
	container.appendChild(pic_link);
	container.appendChild($N("span", {className:"name"}, name_link));
	return container;
}, toggleVisibility:function (first_time) {
	if (!first_time) {
		toggleDisplayNone(this.target);
	}
}});
function StoryParticipants(targetId) {
	var asyncUri = "/ajax/feed_participants_ajax.php";
	this.parent.construct(this, targetId, asyncUri);
}
copy_properties(StoryParticipants.prototype, {initializeFromTarget:function () {
	this.storyKey = this.target.getAttribute("story_key");
	this.storyUser = this.target.getAttribute("user");
}, getFetchData:function () {
	return {sid:this.storyKey, uid:this.storyUser};
}});
StoryParticipants.extend("InlineParticipants");
function MutualFriends(targetId, max) {
	this.max = max;
	var asyncUri = "/ajax/mutual_friends_ajax.php";
	this.parent.construct(this, targetId, asyncUri);
}
copy_properties(MutualFriends.prototype, {initializeFromTarget:function () {
	this.friend = this.target.getAttribute("friend");
}, getFetchData:function () {
	fetch_data = {uid:this.friend};
	if (this.max) {
		fetch_data.max = this.max;
	}
	return fetch_data;
}, getSearchText:function () {
	return _tx("See all mutual friends");
}});
MutualFriends.extend("InlineParticipants");
function SearchMutualFriends(targetId) {
	this.parent.construct(this, targetId);
}
copy_properties(SearchMutualFriends.prototype, {getFetchData:function () {
	return {uid:this.friend, max:8};
}});
SearchMutualFriends.extend("MutualFriends");
function SuggestionReceivers(targetId, suggesters, newcomer, receiver) {
	var asyncUri = "/ajax/suggestion_receivers_ajax.php";
	copy_properties(this, {suggesters:suggesters, newcomer:newcomer, receiver:receiver});
	this.parent.construct(this, targetId, asyncUri);
}
copy_properties(SuggestionReceivers.prototype, {getFetchData:function () {
	return {suggesters:this.suggesters, newcomer:this.newcomer, receiver:this.receiver};
}, initializeFromTarget:bagofholding});
SuggestionReceivers.extend("InlineParticipants");
function LikeParticipants(feedback_params, target_id, search_uri) {
	var asyncUri = "/ajax/like/participants.php";
	copy_properties(this, {feedback_params:feedback_params, search_uri:search_uri});
	this.parent.construct(this, target_id, asyncUri);
}
copy_properties(LikeParticipants.prototype, {getTargetFromId:function (targetId) {
	return $(targetId).scry(".like_users")[0];
}, getFetchData:function () {
	return {feedback_params:JSON.encode(this.feedback_params)};
}, getSearchUri:function () {
	return this.search_uri;
}, fetchedActorsResponse:function (response) {
	LikeController.informUpdateState(this.feedback_params.target_fbid, response.getPayload().like_state_info);
	this.parent.fetchedActorsResponse(response);
}, initializeFromTarget:bagofholding, toggleVisibility:function (first_time) {
	if (first_time) {
		toggle_feedcomments_box_open(this.feedback_params.target_fbid, this.feedback_params.item_id, this.feedback_params.source, false);
	}
	CSS.toggleClass(this.target.parentNode, "participants_not_expanded");
	this.parent.toggleVisibility(first_time);
}});
LikeParticipants.extend("InlineParticipants");
function LikeController() {
}
copy_properties(LikeController, {constructLP:function (dom_obj) {
	var target_info = collect_data_attrib(dom_obj, "comment");
	target_info.actor = target_info.target_owner;
	var box_id = "like_box_" + target_info.item_id + "_" + target_info.target_fbid;
	var href = new URI("/social_graph.php").setQueryData({node_id:target_info.target_fbid, "class":"LikeManager"}).toString();
	new LikeParticipants(target_info, box_id, href);
}, saveChangeLike_d:function (dom_obj, like_exists) {
	var target_info = collect_data_attrib(dom_obj, "comment");
	target_info.link_data = collect_data_attrib(dom_obj, "ft");
	target_info.actor = target_info.target_owner;
	return LikeController.saveChangeLike(target_info, like_exists, target_info.check_hash);
}, saveChangeLike:function (feedback_params, like_exists, check_hash) {
	var target_fbid = feedback_params.target_fbid;
	var data = {feedback_params:JSON.encode(feedback_params), should_delete:!like_exists, check_hash:check_hash};
	LikeController.informChangeLike(target_fbid, like_exists);
	if (like_exists) {
		toggle_feedcomments_box_open(feedback_params.target_fbid, feedback_params.item_id, feedback_params.source, false);
	}
	var handler = bind(null, LikeController.changeLikeResponse, target_fbid, like_exists);
	new AsyncRequest().setURI("/ajax/like/like.php").setData(data).setHandler(handler).setErrorHandler(handler).send();
}, changeLikeResponse:function (target_fbid, like_exists, response) {
	if (response.isReplay()) {
		LikeController.informChangeLike(target_fbid, like_exists);
	}
	if (response.getError()) {
		if (!response.getErrorIsWarning()) {
			LikeController.informChangeLike(target_fbid, !like_exists);
		}
		ErrorDialog.showAsyncError(response);
	} else {
		LikeController.informUpdateState(target_fbid, {payload:response.payload});
	}
}, informChangeLike:function (target_fbid, like_exists) {
	LikeController.informUpdateState(target_fbid, {exists:like_exists});
}, informUpdateState:function (target_fbid, message) {
	Arbiter.inform("like/update/" + target_fbid, message);
}});
function LikeComponent(feedback_params, exists, container_id) {
	copy_properties(this, {feedback_params:feedback_params, exists:exists, container_id:container_id, container:null});
	Arbiter.subscribe("like/update/" + feedback_params.target_fbid, this.updateState.bind(this));
}
copy_properties(LikeComponent.prototype, {updateState:function (type, message) {
	if (!this.init()) {
		return;
	}
	this._updateState(message);
}, _hasMarkup:function (exists) {
	if (exists) {
		return (DOM.scry(this.sentence_container, "div.like_component_exists")[0] != null);
	} else {
		return (DOM.scry(this.sentence_container, "div.like_component_not_exists")[0] != null);
	}
}, _updateState:function (message) {
	if (typeof message.exists != "undefined") {
		this._updateLikeState(message.exists);
	}
	if (typeof message.payload != "undefined" && !this._hasMarkup(message.payload.disp_exists)) {
		this._updatePayload(message.payload);
	}
}, _updatePayload:function (payload) {
	this.init();
}, _updateLikeState:function (exists) {
	if (exists == this.exists) {
		return;
	}
	this.exists = exists;
	this.updateClasses();
}, init:function () {
	if (!this.container) {
		this.container = ge(this.container_id);
	}
	return !!this.container;
}, updateClasses:function () {
	CSS.conditionClass(this.container, "like_exists", this.exists);
	CSS.conditionClass(this.container, "like_not_exists", !this.exists);
}, _updateContent:function (div_exists, div_not_exists, content_exists, content_not_exists) {
	content_exists = HTML(content_exists);
	content_not_exists = HTML(content_not_exists);
	if (div_exists && content_exists != div_exists.innerHTML) {
		DOM.setContent(div_exists, content_exists);
	}
	if (div_not_exists && content_not_exists != div_not_exists.innerHTML) {
		DOM.setContent(div_not_exists, content_not_exists);
	}
}});
function LikeLink(feedback_params, exists, container_id) {
	this.parent.construct(this, feedback_params, exists, container_id);
}
LikeLink.extend("LikeComponent");
function LikeBox(feedback_params, exists, has_other_users, container_id) {
	copy_properties(this, {has_other_users:has_other_users, animating:false, pending_animation:false});
	this.parent.construct(this, feedback_params, exists, container_id);
}
copy_properties(LikeBox, {BOX_ANIM_TIME:200, SENTENCE_ANIM_TIME:200, PIC_ANIM_TIME:300});
copy_properties(LikeBox.prototype, {init:function () {
	if (!this.parent.init()) {
		return false;
	}
	copy_properties(this, {sentence_container:DOM.scry(this.container, "div.like_sentence_container")[0], sentence_exists:DOM.scry(this.container, "div.like_sentence_exists")[0], sentence_not_exists:DOM.scry(this.container, "div.like_sentence_not_exists")[0]});
	if (!this.sentence_container) {
		var ufi = this.container.appendChild($N("div", {className:"ufi_section participants_not_expanded"}));
		this.sentence_container = ufi.appendChild($N("div", {className:"like_sentence_container"}));
		ufi.appendChild($N("div", {className:"like_users clearfix pictures_container", style:{display:"none"}}));
	}
	return true;
}, updateClasses:function () {
	this.parent.updateClasses();
	var has_likes = this.exists || this.has_other_users;
	CSS.conditionClass(this.container, "has_likes", has_likes);
	CSS.conditionClass(this.container, "no_likes", !has_likes);
}, onDoneAnimating:function () {
	this.animating = false;
	if (this.pending_animation) {
		this.pending_animation = false;
		this.animate();
	} else {
		this.updateClasses();
	}
}, _updatePayload:function (payload) {
	if (typeof payload.like_sentence != "undefined" && this.container) {
		this.sentence_container.appendContent(HTML(payload.like_sentence));
		this.parent._updatePayload(payload);
	}
	if (this.exists == payload.disp_exists) {
		this.animate();
	}
}, _updateState:function (message) {
	if (message.sentence_exists && message.sentence_not_exists) {
		this._updateContent(this.sentence_exists, this.sentence_not_exists, message.sentence_exists, message.sentence_not_exists);
		if (!this.init()) {
			return false;
		}
	}
	this.parent._updateState(message);
}, _updateLikeState:function (exists) {
	if (exists == this.exists) {
		return;
	}
	this.exists = exists;
	return this.animate();
}, animate:function () {
	var has_both = this._hasMarkup(true) && this._hasMarkup(false);
	var from_nothing = this._hasMarkup(true) && this.exists && !this.has_other_users;
	if (!(has_both || from_nothing)) {
		return false;
	}
	if (this.animating) {
		this.pending_animation = !this.pending_animation;
		return false;
	}
	this._animate();
}, _animate:function () {
	this.animating = true;
	var was_expanded = (!this.exists || this.has_other_users);
	var expanded = (this.exists || this.has_other_users);
	var ondone = bind(this, "onDoneAnimating");
	if (!was_expanded && expanded) {
		ondone();
		CSS.setOpacity(this.sentence_container, 0);
		animation(this.container).from("height", "0px").to("height", "auto").duration(LikeBox.BOX_ANIM_TIME).show().go();
		animation(this.sentence_container).to("opacity", 1).duration(LikeBox.BOX_ANIM_TIME).go();
		return;
	} else {
		if (was_expanded && !expanded) {
			var close_ondone = bind(this, function () {
				ondone();
				feed_comment_hide_add_box(this.feedback_params.target_fbid, this.feedback_params.item_id, this.feedback_params.source, true);
			});
			animation(this.sentence_container).to("opacity", 0).duration(LikeBox.BOX_ANIM_TIME).go();
			animation(this.container).to("height", "0px").duration(LikeBox.BOX_ANIM_TIME).hide().ondone(close_ondone).go();
			return;
		}
	}
	var sentence_show = this.exists ? this.sentence_exists : this.sentence_not_exists;
	var sentence_hide = this.exists ? this.sentence_not_exists : this.sentence_exists;
	animation(sentence_hide).to("opacity", 0).duration(LikeBox.SENTENCE_ANIM_TIME).hide().go();
	var sentence_show_anim = animation(sentence_show).from("opacity", 0).to("opacity", 1).duration(LikeBox.SENTENCE_ANIM_TIME).show();
	var viewer_pic = DOM.scry(this.container, "div.like_participant_viewer")[0];
	if (!viewer_pic) {
		sentence_show_anim.ondone(ondone);
	}
	sentence_show_anim.go();
	animation(this.sentence_container).from("height", Vector2.getElementDimensions(sentence_hide).y).to("height", Vector2.getElementDimensions(sentence_show).y).duration(LikeBox.SENTENCE_ANIM_TIME).go();
	if (viewer_pic) {
		var border_pic = DOM.scry(this.container, "div.like_participant_border")[0];
		if (this.exists) {
			CSS.setOpacity(viewer_pic, 0);
			var viewer_anim = animation(viewer_pic).from("width", "0px").to("width", "auto").show().duration(LikeBox.PIC_ANIM_TIME).checkpoint().to("opacity", 1).duration(LikeBox.PIC_ANIM_TIME).ondone(ondone);
			if (border_pic) {
				animation(border_pic).to("opacity", 0).hide().duration(LikeBox.PIC_ANIM_TIME).ondone(bind(viewer_anim, viewer_anim.go)).go();
			} else {
				viewer_anim.go();
			}
		} else {
			var viewer_anim = animation(viewer_pic).to("opacity", 0).duration(LikeBox.PIC_ANIM_TIME).checkpoint().to("width", "0px").duration(LikeBox.PIC_ANIM_TIME);
			if (border_pic) {
				var border_anim = animation(border_pic).from("opacity", 0).to("opacity", 1).show().duration(LikeBox.PIC_ANIM_TIME).ondone(ondone);
				viewer_anim.ondone(bind(border_anim, border_anim.go));
			} else {
				viewer_anim.ondone(ondone);
			}
			viewer_anim.go();
		}
	}
}});
LikeBox.extend("LikeComponent");
function TextAreaControl(textarea) {
	copy_properties(this, {autogrow:false, clearHeightOnBlur:false, shadow:null, originalHeight:null, metricsValue:null});
	this.parent.construct(this, textarea);
}
TextAreaControl.extend("TextInputControl");
copy_properties(TextAreaControl.prototype, {setAutogrow:function (autogrow, clearHeightOnBlur) {
	this.autogrow = autogrow;
	this.clearHeightOnBlur = clearHeightOnBlur;
	this.refreshShadow();
	CSS.addClass(this.getRoot(), "DOMControl_autogrow");
	return this;
}, setFocused:function (focused) {
	if (this.autogrow && !focused && this.isEmpty() && this.clearHeightOnBlur) {
		this.getRoot().style.height = "";
	}
	return this.parent.setFocused(focused);
}, setOriginalHeight:function (height) {
	this.originalHeight = height;
	return this;
}, onupdate:function () {
	this.parent.onupdate();
	var r = this.getRoot();
	if (this.autogrow && r.value != this.metricsValue) {
		this.metricsValue = r.value;
		if (CSS.getStyle(r, "fontSize") == "") {
			return false;
		}
		copy_properties(this.shadow.style, {fontSize:parseInt(CSS.getStyle(r, "fontSize"), 10) + "px", fontFamily:CSS.getStyle(r, "fontFamily"), width:Math.max(Vector2.getElementDimensions(r).x - 8, 0) + "px"});
		DOM.setContent(this.shadow, HTML(htmlize(r.value)));
		if (this.isEmpty() && this.originalHeight) {
			r.style.height = this.originalHeight + "px";
		} else {
			r.style.height = Math.max(this.originalHeight, Vector2.getElementDimensions(this.shadow).y + 15) + "px";
		}
	}
}, refreshShadow:function () {
	if (this.autogrow) {
		this.shadow = $N("div", {className:"DOMControl_shadow"});
		DOM.getRootElement().appendChild(this.shadow);
		var r = this.getRoot();
		if (!this.originalHeight) {
			this.originalHeight = parseInt(CSS.getStyle(r, "height"), 10) || Vector2.getElementDimensions(this.getRoot()).y;
		}
	} else {
		if (this.shadow) {
			DOM.remove(this.shadow);
		}
		this.shadow = null;
	}
}});
function autogrow_textarea(element) {
	element = $(element);
	if (!element._hascontrol) {
		element._hascontrol = true;
		new TextAreaControl(element).setAutogrow(true);
	}
}
if (window.Bootloader) {
	Bootloader.done(["js/69gqxn7o10w8ocog.pkg.js"]);
}

